<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Comment</title>
    <link rel="stylesheet" href="css/comment.css">
    <link rel="stylesheet" href="css/blog_login.css">
    <link rel="stylesheet" href="editor.md/css/editormd.min.css">
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="editor.md/lib/marked.min.js"></script>
    <script src="editor.md/lib/prettify.min.js"></script>
    <script src="editor.md/editormd.js"></script>
</head>

<body>
    <div class="nav">
        <div class="head">
            <div class="head-img">
                <img src="./image/head1.jpeg" alt="ggggg" class="img">
            </div>
            <p id="username">我的博客网站</p>
        </div>
        <div class="funcBar">
            <div class="choice">
                <a href="#" class="choice-c">主页</a>
                <a href="#" class="choice-c">写博客</a>
                <a href="#" class="choice-c">注册</a>
            </div>
        </div>
    </div>
    <div class="login-container">
        <div class="login-card">
            <div id="login-card-title"><b>登录</b></div>
            <div id="login-card-container">
                <div id="login-card-container-login">
                    <div id="login-card-container-login-card">
                        <div id="id-login-mess">
                            <div class="login-mess"><div><b>用户名</b></div></div>
                            <div class="login-mess"><div><b>密码</b></div></div>
                        </div>
                        <div id="input-user-password">
                            <div class="login-input"><input type="text" name="username" id="input-username"></div>
                            <div class="login-input"><input type="password" name="password" id="input-password"></div>
                        </div>
                    </div>
                    <button id="button-submit">提交</button>
                </div>
                
            </div>
        </div>
    </div>
</body>
    <script>
        let button=document.querySelector("#button-submit");
        button.onclick=function(){
            json={
                username:document.getElementById("input-username").value,
                password:document.getElementById("input-password").value
        }
        console.log(json);
            $.ajax({
                url:"blog_login",
                type:"post",
                data:json,
                // contentType:"application/json;charset=utf8",
                success:function(data){
                    if(data.status==0){
                        alert(data.content);
                    }
                    else{
                        console.log(location);
                        console.log("前端接受响应");
                    }
                }
            })
        }
    </script>
</html>